package com.example.lijinyuan.mybutton;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {


    EntityButton entityButton;
    public List<EntityButton> entityButtonList;

    private void doButton(EntityButton entityButton) {
        this.entityButton = entityButton;

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });


        entityButtonList = new ArrayList<>();
        entityButtonList.add(new EntityButton(this, R.id.cantent, R.id.button1, R.id.button2, R.id.button3, "0","1") {
            @Override
            public void button1Click(View v, EntityButton entity) {
                doButton(entity);
                Log.d("aaaaaa", "aaaaaaaaa");
//                Toast.makeText(getApplication(),"aaaaaaa",Toast.LENGTH_SHORT).show();
            }

            @Override
            public void button2Click(View v, EntityButton entity) {

            }

            @Override
            public void button3Click(View v, EntityButton entity) {

            }
        });

    }


}
